<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class ImageController extends BaseController{
	//json取头像文件
	public function list_get_json(){
		$data=M('Image')->select();
		$this->Response($data,'json');

	}

	public function update_put_json(){
		$customer=M('Customer');
		$map['id']=$_SESSION['customer']['id'];
		$res=$customer->where($map)->setField(array('face'=>'face'));
		if($res!==false){
			$data=array(
				'error_no'=>10013,
				'msg'=>'头像更新成功',
				'status'=>1,
			);
		}else{
			$data=array(
				'error_no'=>20013,
				'msg'=>'头像更新失败',
				'status'=>0,
			);
		}
		$this->Response($data,'json');

	}
	public function upload_post_json(){
		$customer=M('Customer');
		$map['id']=$_SESSION['customer']['id'];
		$res=$customer->where($map)->setField(array('face'=>'face'));
		if($res!==false){
			$data=array(
				'error_no'=>10014,
				'msg'=>'头像上传成功',
				'status'=>1,
			);
		}else{
			$data=array(
				'error_no'=>20014,
				'msg'=>'头像上传失败',
				'status'=>0,
			);
		}
		$this->Response($data,'json');

	}


}